package codeGen.core;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;

import codeGen.core.model.TableModel;

public class ServiceGen {
    public static void genCode(TableModel tModel, File output){
        try {
            File service_inter = new File(output, tModel.getToClassName()+"Service.java");
            File service_impl = new File(new File(output, "impl"), tModel.getToClassName()+"ServiceImpl.java");
            FreemarkerUtil.genResource("service_interface.ftl", new FileOutputStream(service_inter), tModel);
            FreemarkerUtil.genResource("service_impl.ftl", new FileOutputStream(service_impl), tModel);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }
}
